package com.ruoyi.service;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.KongAdmin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("SubscribeKong")
public class SubscribeKong {
    @Autowired
    KongAdmin kongAdmin;

    private final String acls="acls";
public String addSubscribe(String serviceName, String consumerName,String group){
    JSONObject requestBody = new JSONObject();
    requestBody.put("group",group);
    String result = kongAdmin.CreatePluginInConsumer(requestBody, consumerName, acls);
    System.out.println("添加订阅："+result);
    return result;
}
public String delSubscribe(String serviceName, String consumerName,String group){
    return kongAdmin.DeletePluginInConsumer(consumerName, acls,group);
}

public String getInfor(String url){
    return kongAdmin.getIt(url);
}


}
